---
import { getCollection, render, type CollectionEntry } from "astro:content";
import MarkdownPostLayout from "../../layouts/MarkdownPostLayout.astro";

export async function getStaticPaths() {
  const posts = await getCollection("blog");
  return posts.map((post: { id: any; }) => ({
    params: { slug: post.id },
    props: { post },
  }));
}

interface Props {
  post: CollectionEntry<"blog">;
}

const { post } = Astro.props as Props;
const { Content } = await render(post);
---

<MarkdownPostLayout formatter={post.data}>
  <Content />
</MarkdownPostLayout>